home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / wordproc / hshell1.arj / ADDRBOOK.HYP < prev    next >
Text File  |  1993-12-29  |  5KB  |  248 lines

  1. .HEADER
  2.   ┌─────────────────────────────────────────────────────────────────────┐
  3.   │  ADDRESS BOOK DATABASE   $1~C45$2~C73│
  4.   └─────────────────────────────────────────────────────────────────────┘
  5. .REMARK Address Book Database example
  6. This shows a simple flat file database, with form fill data entry
  7. and formatted lists.
  8. .
  9. .SCRIPT SETUP
  10. -- allow for re-entry
  11. O#
  12. -- F10 puts back a 'q' - can't allow direct exit from data entry
  13. KF0ZUq
  14. -- set up read mask for formatted list
  15. KG5:NAIKQZWYPTER
  16. -- default selection expression is 1 - this is always TRUE of course!
  17. VS1
  18. -- set up default display mask
  19. KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C25$$K $$Q $$Z $$W
  20. .
  21. .FRAME Database
  22. .TITLE Control menu
  23.  
  24. [e]    ~FData entry~Ke~E                - Add records
  25.  
  26. [l]    ~FData look up~Kl~E              - Look for records by surname
  27.  
  28. [f]    ~AFormatted address listing~Psaddrlist~Kf~E - select item to display notes field
  29.  
  30. [t]    ~ATelephone number listing~Pstellist~Kt~E  - select item to display notes field
  31.  
  32. [s]    ~FSort records~Pssort~Ks~E              - using MSDOS SORT program
  33.  
  34. [p]    ~FPrints~Kp~E                    - Various listings
  35.  
  36. [q]    ~AQuit~PQ~Kq~E                      - to MSDOS
  37.  
  38. .
  39. .SCRIPT sort
  40. -- sort database file using MSDOS SORT command
  41. pSorting database - please wait
  42. -- 'silent' program (hopefully)
  43. d sort < addrbook.dat > addrbook.srt
  44. -- copy back the output
  45. dcopy addrbook.srt addrbook.dat
  46. -- ring that bell
  47. pReady
  48. .
  49. .SCRIPT addrlist
  50. -- show note for input of expression
  51. nSelection Expression
  52. -- set up selection mask
  53. KG6$S
  54. -- and format line
  55. KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C25$$K $$Q $$Z $$W
  56. -- display formatted list and execute result
  57. A@Gaddrbook.dat
  58. .
  59. .SCRIPT tellist
  60. -- Telephone list
  61. -- allow input of expression
  62. nSelection Expression
  63. -- set up selection mask
  64. KG6$S
  65. -- and format line
  66. KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C30$$T
  67. -- display formatted list and execute selected result
  68. A@Gaddrbook.dat
  69. .
  70. .NOTE Selection Expression
  71.  Enter selection expression in HyperShell form
  72.  eg. "T0625"c  - Telephone number contains 0625
  73.      "ADr"e ! "AProf"e   - Title 'Dr' or 'Prof'
  74.  [ Enter  1  to select all records ]
  75.  
  76.  Expression: ~I$S~W34~PVS%s~E~Q
  77.  
  78.     --------------  Fields  -------------------
  79.  A  Title      I  Initials  N  Name
  80.  K  Company
  81.  Q  Addr 1     Z  Addr 2    W  Addr 3  Y  Addr 4
  82.  P  Postcode
  83.  T  Telephone  E  Details   R  Date
  84.  
  85. .REMARK
  86. This has an immediate reference to open the file for extending
  87. .FRAME Data entry
  88. .TITLE For entering data
  89. ~A~Pwaddrbook.dat+~E~Q~H Open database for extend
  90.  
  91.     Title: Initials: Name:
  92.     ~I$A~W5~PVA%s;I~Kt~E  ~I$I~W6~PVI%s;I~E    ~I$N~W30~PVN%s;I~E
  93.     Company:
  94.     ~I$K~W30~PVK%s;I~E
  95.     Address:
  96.     ~I$Q~W30~PVQ%s;I~E
  97.     ~I$Z~W30~PVZ%s;I~E
  98.     ~I$W~W30~PVW%s;I~E
  99.     ~I$Y~W30~PVY%s;I~E  Postcode: ~I$P~W10~PVP%s;I~E
  100.     Telephone:          Notes:        Date:
  101.     ~I$T~W20~PVT%s;I~E  ~I$E~W20~PVE%s;I~E  ~I$4~W11~PVR%s;sinform~E
  102.  
  103. [ESC]     Press escape to cancel entry - select field to edit
  104. [w]       ~APress 'w' to write record~Pswrite~Kw~E
  105.  
  106. [n]       ~APress 'n' to clear fields and start new entry~Psclear;ZUt~Kn~E
  107. [q]      ~AQuit entry~Pw;F~Kq~E~H Close database
  108. .
  109. .SCRIPT write
  110. -- write a record - simply intersperse variables with : character
  111. W$N:$A:$I:$K:$Q:$Z:$W:$Y:$P:$T:$E:$4
  112. -- tell user
  113. pRecord written for $A $I $N
  114. -- position mouse at col 20 line 20
  115. ZX20;ZY20
  116. .
  117. .SCRIPT clear
  118. -- clear all variables
  119. VA;VN;VI;VK;VQ;VZ;VW;VY;VP;VT;VE;VR
  120. -- refresh screen
  121. y
  122. .
  123. .SCRIPT inform
  124. pSelect field to edit or press 'w' to write record
  125. ZX20;ZY18
  126. .
  127. .REMARK 
  128. A    Title
  129. I    Initials
  130. N    Name
  131. K    Company
  132. Q    Addr 1
  133. Z    Addr 2
  134. W    Addr 3
  135. Y    Addr 4
  136. P    Postcode
  137. T    Telephone
  138. E    Details
  139. R    Date
  140.  
  141. .
  142. .FRAME Data look up
  143. .TITLE For displaying data
  144. ~A~Praddrbook.dat~E~Q~H Open for reading
  145.  
  146. Name:        $A $I $N
  147. Company:    $K
  148.  
  149. Address:    $Q
  150.         $Z
  151.         $W
  152.         $Y
  153. Postcode:    $P~C40
  154. Telephone:    $T~C40
  155.  
  156. Notes: $E    Date: $R
  157.  
  158. [ ]       ~APress space bar for next record~Psnext~K ~E
  159. [f]       ~APress 'f' to go to first record~PVk;sLookup~Kf~E
  160. [l]       ~I$k~W20~PVk%s;sLookup~Kl~E  Lookup - enter start of name
  161.  
  162. [q]       ~AQuit lookup~Pr;F~Kq~E
  163. .
  164. .SCRIPT Lookup
  165. -- clear error status
  166. Y
  167. -- look up record starting with lookup string in variable k
  168. Vr!L$k
  169. -- if error set, output message
  170. jsNOT FOUND
  171. -- expand input variable e into fields
  172. er:NAIKQZWYPTER
  173. -- refresh and quit
  174. y;q
  175. -- nothing found
  176. LNOT FOUND
  177. -- insert text on screen
  178. i~X10~Y20~DPNot found~DT
  179. .
  180. .SCRIPT next
  181. Y
  182. -- read into variables
  183. R:NAIKQZWYPTER
  184. -- if EOF, indicate end of file
  185. jsEOF
  186. -- refresh and quit script
  187. y;q
  188. -- End of file label
  189. LEOF
  190. i~X20~Y20~DPEnd of file~DT
  191. .
  192. .REMARK example printouts
  193. .
  194. .FRAME Prints
  195. .TITLE Detailed and simple lists
  196.  
  197. [l]    ~ASimple List~PsList~Kl~E
  198.  
  199. [a]    ~AAddress List~Psadds~Ka~E
  200.  
  201. [d]    ~ADetailed print~PsDetail~Kd~E
  202.  
  203. [q]    ~AQuit to main menu~PF~Kq~E
  204. .
  205. .SCRIPT List
  206. -- tell them to ready printer, throw result away
  207. Y?Ready printer
  208. -- output to printer
  209. O51
  210. -- open data file
  211. raddrbook.dat
  212. -- Loop start
  213. LREAD
  214. -- clear error status
  215. Y
  216. -- read record
  217. R:NAIKQZWYPTER
  218. -- if end of file, branch
  219. jsEOF
  220. -- print out a few fields
  221. o$A $I $N $K
  222. -- loop back
  223. JREAD
  224. -- here at end of file
  225. LEOF
  226. r
  227. .
  228. .SCRIPT adds
  229. -- Address list
  230. Y?Ready printer
  231. O51
  232. raddrbook.dat
  233. LREAD
  234. Y
  235. R:NAIKQZWYPTER
  236. jsEOF
  237. o$A $I $N
  238. o$K
  239. o$Q
  240. o$Z
  241. o$W
  242. o$Y $P
  243. o
  244. JREAD
  245. LEOF
  246. r
  247. .
  248.